package com.bizzard.basic.util;

/**
 * 工具类：封装增删改的返回值
 */
public class AjaxResult {

	private Boolean success = true;
	private String message = "操作成功";
	private Object resultObj;

	public Object getResultObj() {
		return resultObj;
	}

	//链式语法改造
	public AjaxResult setResultObj(Object resultObj) {
		this.resultObj = resultObj;
		return this;
	}

	public AjaxResult(Boolean success, String message) {
		this.success = success;
		this.message = message;
	}
	public AjaxResult(){}
	//链式语法改造
	public static AjaxResult me(){
		return new AjaxResult();
	}

	public Boolean getSuccess() {
		return success;
	}
	//链式语法改造
	public AjaxResult setSuccess(Boolean success) {
		this.success = success;
		return this;
	}
	public String getMessage() {
		return message;
	}
	//链式语法改造
	public AjaxResult setMessage(String message) {
		this.message = message;
		return this;
	}
	@Override
	public String toString() {
		return "AjaxResult [success=" + success + ", message=" + message + "]";
	}

	public static void main(String[] args) {
		AjaxResult result = AjaxResult.me().setMessage("删除失败").setSuccess(false);
		System.out.println(result);
	}

}
